package Offer.offer2016;


public class Test33 
{

	public static void main(String[] args) 
	{
		int[] array={3,32,321};
		printMixNumber(array);
	}
	public static void printMixNumber(int[] array)
	{
		if(array==null||array.length==0)
			return;
		for(int i=0;i<array.length;i++)
		{
			for(int j=array.length-1;j>i;j--)
				if(compare(array[j], array[j-1])<0)
				{
					int temp=array[j-1];
					array[j-1]=array[j];
					array[j]=temp;
				}
		}
		for(int i=0;i<array.length;i++)
		{
			System.out.print(array[i]);
		}
		
	}
	public static int compare(int num1,int num2)
	{
		String st1=num1+""+num2;
		String st2=num2+""+num1;
		return st1.compareTo(st2);
	}
}

